package acmtests;

import java.util.Arrays;
import java.util.Random;

import edg.acm.ConfigurationModel;
import edg.acm.ConfigurationParameter;
import edg.acm.ConfigurationWorker;
import edg.acm.Files;

public class xmltest {
	
	static Random gen = new Random();
	
	public static ConfigurationModel generateRandomModel() {
    	int ran;
    	int[] acuit_p = new int[]{0,0,0,0,0,100};
    	for (int i=0; i<5; i++) acuit_p[i] = gen.nextInt(100);
    	Arrays.sort(acuit_p);
    	System.out.println(Arrays.toString(acuit_p));
    	for (int i=5; i>0; i--) acuit_p[i] -= acuit_p[i-1];
    	
        ConfigurationModel cm = ConfigurationModel.createNewConfigModel();
        for (ConfigurationParameter param : ConfigurationParameter.getParameters()) {
            String name = param.getName();
            if (name.equals("runs")) {
            	System.out.println("Setting " + name + " to " + 1);
                cm.setValue(name, 1);
            } else if (name.equals("hours")) {
            	System.out.println("Setting " + name + " to " + 24);
                cm.setValue(name, 24);
            } else if (name.equals("rate")) {
            	System.out.println("Setting " + name + " to " + 10);
                cm.setValue(name, 10);
            } else if (name.startsWith("acuity")) {
            	int i = acuit_p[Integer.valueOf(name.substring(6))-1];
            	System.out.println("Setting " + name + " to " + i);
                cm.setValue(name, i);
            } else if (name.equals("walkin")) {
            	ran = gen.nextInt(101);
            	System.out.println("Setting " + name + " to " + ran);
                cm.setValue(name, ran);
            } else {
            	ran = gen.nextInt(10) + 1;
            	System.out.println("Setting " + name + " to " + ran);
                cm.setValue(name, ran);
                
            }
        }
        return cm;
	}
	
    public static void main(String[] args) {
    	ConfigurationModel cm = generateRandomModel();
        
        Files files = ConfigurationWorker.generateXML(cm);
        System.out.println(files.romeo);
        System.out.println(files.jsim);
        System.out.println(files.allocation);
        System.out.println(files.utilization);
    }
}